package com.smart.common.response;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 作者: JinMenglong
 * 描述:
 * 日期: Create in 2020-12-16 23:04
 * 修改人:
 * 最后一次修改时间:
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result<T> {

    private boolean success;
    private int code;
    private String msg;
    private T data;

    public Result(boolean success, int code, String msg) {
        this.success = success;
        this.code = code;
        this.msg = msg;
    }

    public static Result<Object> SUCCESS() {
        return new Result<Object>(true, 1, "执行成功");
    }

    public static Result<Object> SUCCESS(String msg) {
        return new Result<Object>(true, 1, msg);
    }

    public static Result<Object> FAIL() {
        return new Result<Object>(false, 0, "执行失败");
    }

    public static Result<Object> FAIL(String msg) {
        return new Result<Object>(false, 0, msg);
    }


}
